
import { BrowserRouter as Router, Routes, Route, Navigate, createBrowserRouter } from 'react-router-dom'
import gongneng from "../pages/gongneng"
import home from "../pages/home"
import layout from '../layout'
import text from "../pages/text"
import other from "../pages/other"
import EcharsMap from "../pages/echarsMap"
import EcharsMap1 from "../pages/echarsMap1"
import PageOne from "../pages/pageOne"
import PageTwo from "../pages/pageTwo"
import Login from "../pages/login"
import PageThree from "../pages/PageThree"
const router = [{
    path: '/',
    Component: layout,
    exact: true,
    children: [

        {
            // 重定向
            path: 'layout',
            element: <Navigate to="/home" replace />,
            exact: true,
            // children: []
        },
        {
            path: 'home',
            Component: home,
            exact: true,
            // children: []
        },
        {
            path: 'gongneng',
            Component: gongneng,
            // element: <gongneng />,
            exact: true,
            // children: []
        },
        // {
        //     path: 'echars',
        //     component: EcharsMap,
        //     exact: true,
        //     children: [
        //         {
        //             path: '/echars/echarsMap',
        //             Component: EcharsMap1,
        //             exact: true,
        //         },
        //         {
        //             path: '/echars/echarsMap1',
        //             Component: EcharsMap1,
        //             exact: true,
        //         },

        //     ]
        // },
        {
            path: 'echars',
            component: EcharsMap,
            exact: true,
            children: [
                {
                    path: '/echars/echarsMap',
                    Component: EcharsMap,
                    exact: true,
                    // element: <PageOne />,
                    // children: []
                },
                {
                    path: '/echars/echarsMap1',
                    Component: EcharsMap1,
                    exact: true,
                    // element: <PageTwo />,//element和Component不能同时使用
                },
            ]
        },
        {
            path: 'text',
            Component: text,
            exact: true,
            // children: []
        },
        {
            path: 'other',
            component: PageOne,
            exact: true,
            children: [
                {
                    path: '/other/pageOne',
                    Component: PageOne,
                    exact: true,
                    // element: <PageOne />,
                    // children: []
                },
                {
                    path: '/other/pageTwo',
                    Component: PageTwo,
                    exact: true,
                    // element: <PageTwo />,//element和Component不能同时使用
                },
                {
                    path: '/other/pageThree',
                    Component: PageThree,
                    exact: true,
                    // element: <PageTwo />,//element和Component不能同时使用
                },
            ]
        },

        {
            path: '*',
            Component: home,
            exact: true,
            // children: []
        }
    ]

}, {
    path: 'login',
    Component: Login,
}]
export default createBrowserRouter(router)